
--------------传送
AddModRPCHandler("mymod", "ChuanSong", function(p, x, z)
	if not _G.TheWorld.ismastersim then
		return
	end
	if p.Physics then
		p.Physics:Teleport(x, 0, z)
	else
		p.Transform:SetPosition(x, 0, z)
	end
end)
local half_x, half_y = _G.RESOLUTION_X / 2, _G.RESOLUTION_Y / 2
local screen_width, screen_height = _G.TheSim:GetScreenSize()
local function ScreenPosToWorldPos()
	local screen_x, screen_y = _G.TheSim:GetPosition()
	local map_x = (screen_x / screen_width * _G.RESOLUTION_X - half_x) / half_x
	local map_y = (screen_y / screen_height * _G.RESOLUTION_Y - half_y) / half_y
	return _G.TheWorld.minimap.MiniMap:MapPosToWorldPos(map_x, map_y, 0)
end
local function ChuanSong(key)
	if key ~= 44 or not shunyi then return end
	local x, z = ScreenPosToWorldPos()
	SendModRPCToServer(MOD_RPC["mymod"]["ChuanSong"], x, z)
end
local function OnRawKey(key, down)
	if _G.ThePlayer and _G.ThePlayer.HUD and _G.ThePlayer:IsValid() and not down then
		local isWill = _G.ThePlayer.prefab ~= 'wortox'
		if isWill then
			if _G.ThePlayer.HUD:IsMapScreenOpen() then
				ChuanSong(key)
			end
		end
	end
end

_G.TheInput:AddKeyHandler(OnRawKey)
-----------------------------------------------------------------------------------------分界线